//-------------------------------------------------------------------
//	Copyright (c) 2010-2012 Zhirnov Andrey
//	This file is part of the "UXGEN" project.
//	See copyright notice in "Engine.h".
//-------------------------------------------------------------------

#ifndef _UX_WIN_AVI_VIDEO_ENCODER_H
#define _UX_WIN_AVI_VIDEO_ENCODER_H

#include "IVideoEncoder.h"

#ifdef PLATFORM_WINDOWS

namespace Engine
{
namespace CoreSystems
{

	//
	// AVI Video Encoder
	//

	class CAVIVideoEncoder : public IVideoEncoder
	{
	private:
		BITMAPINFOHEADER	_sBitmapHeader;
		PAVIFILE			_pFile;
		PAVISTREAM			_pStream;
		PAVISTREAM			_pCompStream;
		uint				_uFrame;

	public:
		CAVIVideoEncoder();
		virtual ~CAVIVideoEncoder();

		virtual bool  AddFrame(const binary_buffer_t &sFrame);
		virtual bool  CreateStream(const char * pFileName, const uvec2 &vSize, uint uFrameRate, e_video_create::type eType = e_video_create::AUTO);
		virtual void  CloseStream();

		virtual uint  GetFramesCount()	const	{ return _uFrame; }
		virtual uint  GetFrameSize()	const	{ return _sBitmapHeader.biSizeImage; }
		virtual bool  IsReady()			const	{ return _pCompStream != NULL; }
	};

//-------------------------------------------------------------------

}	// CoreSystems
}	// Engine

#endif	// PLATFORM_WINDOWS

#endif	// _UX_WIN_AVI_VIDEO_ENCODER_H